const express = require("express")

const expressJoi = require("@escook/express-joi")

const router = express.Router()
// 导入文章分类相关的路由函数
const artcate_handler = require("../router_handler/artcate")
// 导入添加文章分类的表单验证规则
const { add_cate_schema, delete_cate_schema, get_cate_schema, update_cate_schema } = require("../schema/artcate")

// 获取文章分类列表
router.get("/cates", artcate_handler.getArticleCates)

// 新增文章分类
router.post("/addcates", expressJoi(add_cate_schema), artcate_handler.addArticleCates)

// 根据id删除文章分类
router.post("/deletecates/:id", expressJoi(delete_cate_schema), artcate_handler.deleteArticleCates)

// 根据id获取文章分类
router.get("/cates/:id", expressJoi(get_cate_schema), artcate_handler.getArticleCateById)

// 根据 Id 更新文章分类数据
router.get("/updatecate", expressJoi(update_cate_schema), artcate_handler.updateCateById)

module.exports = router